﻿if (typeof Sotipha == "undefined") Sotipha = {};
if (typeof Sotipha.View == "undefined") Sotipha.View = {};
Sotipha.View.Partner = {}

$(function () {
    $('#slider1').anythingSlider({
        autoPlay: true,
        pauseOnHover: false,
        mode: "horizontal",
        startText: "",
        height:800,
        stopText: "",
        delay: 8000,
        animationTime: 700,
        autoPlayLocked: true,
        buildNavigation: false
    });
    imagePreview();
});


this.imagePreview = function () {

    /* CONFIG */

    xOffset = 10;
    yOffset = 30;

    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result

    /* END CONFIG */
    $("#slider1 img").hover(function (e) {
        this.t = this.title;
        var pattern = '{0}: {1}</br>{2}: {3}</br>{4}: {5}</br>{6}: {7}</br>';
        var content = $.string.Format(pattern, lblCompamy, $(this).attr('name'), lblPhone, $(this).attr('phone'), lblAddress, $(this).attr('address'), 'Website', $(this).attr('website'));
        $("body").append("<p id='preview'>" + content + "</p>");
        $("#preview")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function () {
	    //this.title = this.t;
	    $("#preview").remove();
	});
    $("#slider1 img").mousemove(function (e) {

        $("#preview")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px");
    });
    $("#slider1 img").mouseout(function (e) {

    });

};
